﻿<UserControl 
  x:Class="TheCollectiveNetwork.MainPage"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
  xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
  xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"   
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:CustomControls="clr-namespace:TheCollectiveNetwork.CustomControls"
  mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="1000">

    <Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" Style="{StaticResource LayoutRootGridStyle}">        
        <Border Style="{StaticResource LayoutRootBorderStyle}" >
            <Grid x:Name="LayoutPage">
          

                <!-- Banner-->
                <Grid x:Name="BannerGrid" Style="{StaticResource BannerGridStyle}">
                    <Border x:Name="BannerBorder" Style="{StaticResource BannerBorderStyle}">
                        <Border x:Name="BrandingBorder" Style="{StaticResource BrandingBorderStyle}" >
                            <StackPanel x:Name="BrandingStackPanel" Style="{StaticResource BrandingStackPanelStyle}">
                                <ContentControl Style="{StaticResource LogoIcon}"/>
                                <TextBlock x:Name="TitleTextBlock" Style="{StaticResource ApplicationNameStyle}" Text="{Binding ApplicationStrings.ApplicationName, Source={StaticResource ResourceWrapper}}"/>
                            </StackPanel>
                        </Border>
                    </Border>
                </Grid>
                   
                <!-- Administrator's Toolbar -->
                <ContentControl x:Name="ToolBarContentControlAdmin"  IsEnabled="False" Visibility="Collapsed"  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
                    <Grid x:Name="ToolBarGridAdmin" Style="{StaticResource ToolBarGridStyle}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="50*" />
                            <ColumnDefinition Width="50*" />
                        </Grid.ColumnDefinitions>
                        <StackPanel x:Name="ToolBarStackPanelLeftAdmin" Style="{StaticResource ToolBarStackPanelLeftStyle}" Grid.Column="0">
                            <HyperlinkButton x:Name="ToolBarLinkHomeAdmin" Style="{StaticResource ToolBarLinkStyle}" NavigateUri="/Home" TargetName="ContentFrame" Content="{Binding Path=ApplicationStrings.HomePageTitle, Source={StaticResource ResourceWrapper}}"/>
                            <Rectangle Style="{StaticResource DividerStyle}"/>
                            <HyperlinkButton x:Name="ToolBarLinkAboutAdmin" Style="{StaticResource ToolBarLinkStyle}" NavigateUri="/About" TargetName="ContentFrame" Content="{Binding Path=ApplicationStrings.AboutPageTitle, Source={StaticResource ResourceWrapper}}"/>
                        </StackPanel>
                        <StackPanel x:Name="ToolBarStackPanelRightAdmin" Style="{StaticResource ToolBarStackPanelRightStyle}" Grid.Column="1">
                            <HyperlinkButton x:Name="ToolBarLinkRegistrationRequestsAdmin" Style="{StaticResource ToolBarLinkStyle}" NavigateUri="/Administration/RegistrationRequests" TargetName="ContentFrame" Content="{Binding Path=ApplicationStrings.RegistrationRequestsTitle, Source={StaticResource ResourceWrapper}}"/>
                            <Rectangle Style="{StaticResource DividerStyle}"/>
                            <HyperlinkButton x:Name="ToolBarLinkUserManagementAdmin" Style="{StaticResource ToolBarLinkStyle}" NavigateUri="/Administration/UserManagement" TargetName="ContentFrame" Content="{Binding Path=ApplicationStrings.UserManagementTitle, Source={StaticResource ResourceWrapper}}"/>
                            <Rectangle Style="{StaticResource DividerStyle}"/>
                            <HyperlinkButton x:Name="ToolBarLinkLogouAdmin" Style="{StaticResource ToolBarLinkStyle}" Click="ToolBarLinkLogout_Click"  Content="{Binding Path=ApplicationStrings.LogoutTitle, Source={StaticResource ResourceWrapper}}" />
                        </StackPanel>
                    </Grid>
                </ContentControl>
                
                <!-- User's Toolbar -->
                <ContentControl x:Name="ToolBarContentControlUser"  IsEnabled="False" Visibility="Collapsed"  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
                    <Grid x:Name="ToolBarGrid" Style="{StaticResource ToolBarGridStyle}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="50*" />
                            <ColumnDefinition Width="50*" />
                        </Grid.ColumnDefinitions>
                        <StackPanel x:Name="ToolBarStackPanelLeftUser" Style="{StaticResource ToolBarStackPanelLeftStyle}" Grid.Column="0">
                            <HyperlinkButton x:Name="ToolBarLinkHomeUser" Style="{StaticResource ToolBarLinkStyle}" NavigateUri="/Home" TargetName="ContentFrame" Content="{Binding Path=ApplicationStrings.HomePageTitle, Source={StaticResource ResourceWrapper}}"/>
                            <Rectangle Style="{StaticResource DividerStyle}"/>
                            <HyperlinkButton x:Name="ToolBarLinkAboutUser" Style="{StaticResource ToolBarLinkStyle}" NavigateUri="/About" TargetName="ContentFrame" Content="{Binding Path=ApplicationStrings.AboutPageTitle, Source={StaticResource ResourceWrapper}}"/>
                        </StackPanel>
                        <StackPanel x:Name="ToolBarStackPanelRightUser" Style="{StaticResource ToolBarStackPanelRightStyle}" Grid.Column="1">                            
                            <HyperlinkButton x:Name="ToolBarLinkLogouUser" Style="{StaticResource ToolBarLinkStyle}" Click="ToolBarLinkLogout_Click"  Content="{Binding Path=ApplicationStrings.LogoutTitle, Source={StaticResource ResourceWrapper}}" />
                        </StackPanel>
                    </Grid>
                </ContentControl>

                <!-- Content display -->
                <ContentControl x:Name="MainContentControl"  IsEnabled="False" Visibility="Collapsed"  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">                    
                    <Border x:Name="ContentBorder" Style="{StaticResource ContentBorderStyle}">
                        <navigation:Frame x:Name="ContentFrame"   Style="{StaticResource ContentFrameStyle}" Source="/Home" Navigated="ContentFrame_Navigated" Navigating="ContentFrame_Navigating" NavigationFailed="ContentFrame_NavigationFailed">
                            <navigation:Frame.UriMapper>
                                <uriMapper:UriMapper>
                                    <uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/>
                                    <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
                                </uriMapper:UriMapper>
                            </navigation:Frame.UriMapper>
                        </navigation:Frame>
                    </Border>
                </ContentControl>

                <!-- Login -->
                <ContentControl  x:Name="LoginContentControl"  IsEnabled="True" Visibility="Visible" Style="{StaticResource BaseContentControlStyle}" KeyUp="LoginContentControl_KeyUp">
                        <Border x:Name="LoginBorder" Style="{StaticResource LoginBorderStyle}" >
                            <Grid x:Name="LoginGrid" Style="{StaticResource LoginGridStyle}" >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="20*" />
                                    <ColumnDefinition Width="80*" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="50" />
                                    <RowDefinition Height="50" />
                                    <RowDefinition Height="50" />
                                    <RowDefinition Height="50" />
                                    <RowDefinition Height="30" />
                                </Grid.RowDefinitions>
                                <TextBlock Text="Username"  Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="5" />
                                <TextBlock Text="Password"  Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="5"/>
                                <TextBox x:Name="LoginUsernameText"  Grid.Column="1" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Width="340" />
                            <PasswordBox x:Name="LoginPasswordText"  Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Width="340" />
                                <Button x:Name="LoginButton" Content="Login" Click="LoginButton_Click" Grid.Column="0" Grid.Row ="2" Grid.ColumnSpan="2" Width="150" Margin="5"/>                           
                                
                            <Border x:Name="LoginErrorBorder" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Background="#FFF56E70" Height="25"  CornerRadius="10" Visibility="Collapsed">
                                <TextBlock  x:Name="LoginMessageText" Text=""  Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Foreground="#FFFFFFFF" TextAlignment="Center" />
                            </Border>
                            <HyperlinkButton x:Name="LoginFooterRegisterUser" Click="LoginFooterRegisterUser_Click" Grid.Column="1" Grid.Row="4" Style="{StaticResource GeneralLinkStyleRight1}" Content="Register" HorizontalAlignment="Right"/>
                        </Grid>

                        </Border>                   
                </ContentControl>

                <!--Register -->
                <ContentControl x:Name="RegisterContentControl"  IsEnabled="False" Visibility="Collapsed" Style="{StaticResource BaseContentControlStyle}"  >
                    <Border x:Name="RegisterBorder" Style="{StaticResource RegisterBorderStyle}">
                        <Grid x:Name="RegisterGrid" Style="{StaticResource RegisterGridStyle}" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="24*" />
                                <ColumnDefinition Width="76*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="40" />
                                <RowDefinition Height="60" />
                                <RowDefinition Height="60" />
                            </Grid.RowDefinitions>
                            <TextBlock Text="First Name"  Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="5"/>
                            <TextBlock Text="Last Name"  Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="5"/>
                            <TextBlock Text="Phone"  Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="5"/>
                            <TextBlock Text="Organisation"  Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="5"/>
                            <TextBlock Text="Email"  Grid.Column="0" Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="5" />
                            <TextBlock Text="Password"  Grid.Column="0" Grid.Row="5" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="5"/>
                            
                            <TextBox x:Name="RegisterFirstNameText"  Grid.Column="1" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Width="320" />
                            <TextBox x:Name="RegisterLastNameText"  Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Width="320" />
                            <TextBox x:Name="RegisterPhoneText"  Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Width="320" />
                            <TextBox x:Name="RegisterOrganisationText"  Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Width="320" />
                            <TextBox x:Name="RegisterEmailText"  Grid.Column="1" Grid.Row="4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Width="320" />
                            
                            <PasswordBox x:Name="RegisterPasswordText"  Grid.Column="1" Grid.Row="5" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Width="320" />
                            

                            <StackPanel x:Name="RegisterControlsStackPanel"  Grid.Column="0" Grid.Row ="6" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,20,0,0">
                               <Button x:Name="RegisterButton" Content="Submit Registration" Click="RegisterButton_Click" Width="150" Margin="5"/>
                               <Button x:Name="RegisterCloseButton" Content="Close" Click="RegisterCloseButton_Click" Width="150" Margin="5"/>
                            </StackPanel>
                            
                            
                            <TextBlock  x:Name="RegisterMessageText" Text=""  Grid.Column="0" Grid.Row="7" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" TextAlignment="Center" TextWrapping="Wrap" />
                            
                          
                        </Grid>

                    </Border>
                </ContentControl>

                <!-- Password Change Control -->                
                <ContentControl  x:Name="PasswordChangeControl"  IsEnabled="False" Visibility="Collapsed" Style="{StaticResource BaseContentControlStyle}" >
                    <CustomControls:MainPasswordChangeControl x:Name="MainPasswordChangeCtrl"  CloseControl="MainPasswordChangeCtrl_CloseControl"/>
                </ContentControl>

            </Grid>


        </Border>
    </Grid>
</UserControl>